﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net.Mail;

using System.Net;
using System.Data;
using DTN.Core;
using Hanel.DTN.News;
using System.Text;
using System.IO;

public partial class News : System.Web.UI.MasterPage
{
    ItblEventManager obj = tblEventManager.CreateInstance();
    ItblContentManager objcontent = tblContentManager.CreateInstance();

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public string BindTieuDiem() // hien thi tin duoc cho la tieu diem, hot nhat, trong Ihost=1 se xac dinh tin nay, sap xep theo ngay moi nhat
    {
        string data = string.Empty;
        try
        {
           
            DataTable dt = objcontent.SelecttblContentDynamic_top("Top 6", "Status=1 and Ihost=1", "Ngay desc"); //Ihost=1 tuc la lua chon tin do lam tin tieu diem
            data += "<div class=\"videoContent\">";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                data += " <div class=\"subpanel subpanel102\">";
                data += "<a href=\"javascript:void(0)\" class=\"image\">";
                data += "<img src=\""+dr["LinkImage"]+"\" alt=\"\" title=\"\" width=\"95\" height=\"65\">";
                data += "</a>";
                data += "<a href=\"News.aspx?ID="+dr["ID"]+"\" class=\"link\">"+dr["Title"]+"</a>";
                data += "<p class=\"author\"></p>";
                data += "<p class=\"file\"></p>";
                data += "<p class=\"desc\"></p>";
                data += "</div>";
            }
            data += "<br class=\"clear\">";
            data += "</div>";
        }
        catch
        {
            return data;
        }
        return data;
    }

    public string BindEvent() //Muc cac su kien
    {
        string data = string.Empty;
        try
        {

            DataTable dt = obj.SelecttblEventDynamic_top("Top 4", "active=1", "[Order] desc");
            data += "<div id=\"eventSlide\" class=\"panel1 event w170px\">";
            data += "<div class=\"pnl-top top\">";
            data += "<ul class=\"mainNav\">";
            data += "<li class=\"prev\"><a href=\"javascript:void(0)\">«</a></li>";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                data += "<li class=\"itm\"><a class=\"selected\" href=\"javascript:void(0)\">"+(i+1)+"</a>";
                data += "<div class=\"slideContent none\">";
                data += "<a href=\"News.aspx?event="+dr["id"]+"\" class=\"mainArtLink\"><img src=\""+dr["LinkImage"]+"\"></a>";
                data += "<p class=\"title\">"+dr["Name"]+"</p>";
                data += "</div>";
                data += "</li>";
               
            }
            data += "<li class=\"next\"><a href=\"javascript:void(0)\">»</a></li>";
            data += "</ul>";
            data += "<a href=\"\" class=\"pnl-title\">SỰ KIỆN</a>";
            data += "</div>";
            data += "<div style=\"display: block;\" class=\"pnl-content imageDeck\">";
            DataRow dr2 = dt.Rows[0];
            data += "<a href=\"\" class=\"mainArt\"><img src=\"" + dr2["LinkImage"] + "\"  width=\"170\" height=\"110\"></a>";
            data += "</div>";
            data += "</div>";

            data += "<script type=\"text/javascript\">";
            data += "function initEventSlide() { AP.Core.JS.EventSlide.animation = true;AP.Core.JS.EventSlide.init('eventSlide');}AP.Core.JS.Initialization.call(initEventSlide);";
            data += "</script>";
        }
        catch
        {
            return data;
        }
        return data;
    }
}
